import java.util.Random;
import java.util.Scanner;

public class MethodBlogs {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("\"石头剪刀布，电脑已就绪！游戏规则如下：和电脑猜拳\n" + " 1【石头】；2【剪刀】；3【布】\n");
        int comIntegral, plaIntegral;
        plaIntegral = comIntegral = 0;

        while (plaIntegral<5 | plaIntegral<5) {
            Random r = new Random();
            int comPuter = (int) (Math.random() * 3 + 1);
            System.out.println("请输入数字猜拳");
            int player = scan.nextInt();
            if (player==886){
                System.out.println("下次再见咯~");
                break;
            }

            if ((player > 0) & (player < 4)) {
                System.out.println("你的选择为：" + player);
                if (comPuter != player) {
                    if ((player - comPuter == -1) | (player - comPuter == 2)) {
                        plaIntegral += 1;
                        System.out.println("不错不错，竟然真的赢了！本次游戏，电脑出" + comPuter + "你出" + player);
                        System.out.println("目前战况为： 电脑：" + comIntegral + " 分" + "，玩家 " + plaIntegral + " 分");
                        System.out.println("退出游戏请输入886，输入其他数字继续");
                        System.out.println("----------------------------------------\n");
                    } else {
                        comIntegral += 1;
                        System.out.println("还好我技高一筹，你败了！本次游戏，电脑出" + comPuter + "你出" + player);
                        System.out.println("目前战况为： 电脑：" + comIntegral + " 分" + "，玩家 " + plaIntegral + " 分");
                        System.out.println();
                        System.out.println("退出游戏请输入886，输入其他数字继续");
                        System.out.println("----------------------------------------\n");

                    }

                }else if (comPuter == player) {
                    System.out.println("真是太有默契了，电脑出 " + comPuter + "你出" + player);
                    System.out.println("目前战况为： 电脑：" + comIntegral + " 分" + "，玩家 " + plaIntegral + " 分");
                    System.out.println("退出游戏请输入886，输入其他数字继续");
                    System.out.println("----------------------------------------\n");
                }
            }
            else {
                System.out.println("你输入的数字不合法，重新输入吧~");
                System.out.println();
                System.out.println("----------------------------------------\n");
            }

        }

    }

}